<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="format-detection" content="telephone=no">

        <title>我的球票</title>
        
        <link rel="stylesheet" type="text/css" href="css/home.css" />
	</head>
	<body id="home" v-cloak>
		<!--我的球票-->
        <section class="p-wapper">
        	<!--提示信息栏-->
	        <div class="tips-box" v-show="showTips">
	        	<p>只可以查看3个月内苏宁易购和门店的订单哦~</p>
	        	<a href="javascript:;" class="close" @click="showTips = false"></a>
	        </div>
	        <div v-show="myList">
	        	<div class="my-list">
	        		<a href="javascript:;" class="item" v-for="item in items" @click="details(item)">
	        			<div class="info">
	        				<div class="mark left">{{{item.homeTeam | mark}}}</div>
	        				<div class="match">
	        					<ul>
		        					<li class="name"><span class="lt">{{item.homeTeam}}</span><span class="grey">VS</span><span class="rt">{{item.visitorTeam}}</span></li>
		        					<li class="time">{{item.matchTime}} 开赛</li>
	        					</ul>
	        				</div>
	        				<div class="mark right">{{{item.visitorTeam | mark}}}</div>
	        			</div>
	        			<p class="number" :class="{black : item.getTicketStatus=='2'}">{{item.persons}}张 {{item.getTicketStatus | state}}</p>
	        		</a>
	        	</div>
	        	<div class="loading">没有更多了</div>
        	</div>
        	<div class="no-data" v-show="noData">
	        	<div class="icon-nodata"></div>
	        	<p>你还没有购买过球票哦</p>
	        	<div class="go">
	        		<a href="javascript:;"><span>去官网购买球票</span><span class="arrow"></span></a>
	        	</div>
        	</div>
        </section>
        
        <script type="text/javascript" src="js/jquery.min.js"></script>
        <script type="text/javascript" src="js/vue.min.js"></script>
        <script type="text/javascript" src="js/vue-config.js"></script>
        <script type="text/javascript" src="js/common.js"></script>
        <script src="https://passport.suning.com/ids/js/passport.js"></script>
        
        <script type="text/javascript">
        	var vm = new Vue({
                el: '#home',
                data: {
	                items: [],
	                showTips: true,
	                returnTag:"",
	                myList: true,
	                noData: false,
	                
                    err: false,
                    errCtt: ""
                },
                computed: {
                    
                },
                methods: {
                	details: function(item){
                    	location.href = "ticket_details.html?orderCode=" + item.orderCode;
                    }
                },
                ready: function(){
                	probeAuthStatus(function(){
                        $.ajax({
	                    	type: "post",
	                    	dataType: "jsonp",
	                        url: Suningmatch.DI.orderList,
	//                      url: "js/activityShow.json",
	                        success: function(data){
	                        	console.log(data);
	                        	vm.returnTag = data.returnTag;
	                            if(data.returnTag=="0"){
	                            	vm.items = data.orderList;
	                            	if(data.orderList.length != "0"){
	                            		vm.noData = false;
	                            		vm.myList = true;
	                            	}else{
	                            		vm.myList = false;
	                            		vm.noData = true;
	                            	}
	                            	
	                            }else{
	                            	location.href = "404.html";
	                            }
	                        },
	                        error: function(err){
	                            vm.errCtt = "系统异常";
	                            vm.err = true;
	                            var timer = setTimeout(function(){
	                                vm.err = false;
	                                
	                                clearTimeout(timer);
	                                timer = null;
	                            }, 2000);
	                        }
	                    });
                    }, function(){
                        location.href = Suningmatch.wxLogin + encodeURIComponent(location.href);
                    });
                }
            });
        </script>
	</body>
</html>
